<?php
namespace Mobile\Controller;
use Think\Controller;

class SettingController extends Controller {


    public function changepwd(){


        $username = I('username', '');
        $old_password = I('old_password', '');
        $password = I('password', '');

        $member_model = M('Members');

        $member = $member_model->where(array('member_login_name' => $username, 'member_password' => md5($old_password)))->find();

        if($member){
            $res = $member_model->where('member_login_name='.$username)->setField("member_password", md5($password));
            if($res){
                $this->ajaxReturn(array('status' => 1, 'info' => '修改成功', 'data' => null, 'jumpUrl' => null));
            }else{
                $this->ajaxReturn(array('status' => 0, 'info' => '修改失败', 'data' => null, 'jumpUrl' => null));
            }
        }else{
            $this->ajaxReturn(array('status' => -1, 'info' => '旧密码错误', 'data' => null, 'jumpUrl' => null));
        }



    }

   
}